<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 * @author   howe <howe1995@163.com>
 */
use Hyperf\Database\Migrations\Migration;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Schema\Schema;

return new class() extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('moments', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->default(0)->comment('用户ID');
            $table->enum('type', ['text', 'image', 'video'])->default('text')->comment('类型');
            $table->string('content', 1000)->default('')->comment('文案');
            $table->string('visible', 255)->default('')->comment('谁可以看');
            $table->string('invisible', 255)->default('')->comment('谁不可以看');
            $table->enum('perm', ['public', 'private', 'visible', 'invisible'])->default('public')->comment('权限');
            $table->timestamp('created_at')->useCurrent()->comment('创建时间');
            $table->timestamp('updated_at')->useCurrent()->comment('更新时间');
            $table->timestamp('deleted_at')->nullable()->default(null)->comment('删除时间');
            $table->index(['user_id'], 'idx_user_id', 'BTREE');
            $table->comment('朋友圈表');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('moments');
    }
};
